﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Micronet.OpenWeb.Com.Controls;
using Micronet.OpenWeb.Com.BLL;
using Micronet.OpenWeb.Common;
using Micronet.OpenWeb.Utils;

namespace Micronet.OpenWeb.OpenWeb.Admin.Views.Shared.OpenPersonality
{
    public partial class HomeProfileMaritalProcessAdmin : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HomeProfileMaritalProcessGrid.ItemCommand += new Telerik.Web.UI.GridCommandEventHandler(HomeProfileMaritalProcessGrid_ItemCommand);
        }

        void HomeProfileMaritalProcessGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "InitInsert")
            {
                Response.Redirect("../Site/HomeProfileMaritalProcessEdit.aspx");
            }
        }
        protected void IsDeletedCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            var isDeletedCheckBox = (OwCheckBox)sender;
            var obj = OwOpenHomeProfileMaritalProcessBLL.OwGetEntity(isDeletedCheckBox.Text.Trim().OwToInt64TryParse());
            //Response.Write(obj.OpenHomeProfileDetailID);
            obj.IsDeleted = isDeletedCheckBox.Checked.ToString().OwToBoolean();
            if (OwOpenHomeProfileMaritalProcessBLL.OwSave(obj) > 0)
            {
                HomeProfileMaritalProcessGrid.Rebind();
                //Alert();
            }
        }
    }
}